package reflect;


import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;


public class RefiectDemo5 {
    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
       Class cls=Class.forName("reflect.Person");
       Object obj=cls.newInstance();

        Method methods = cls.getMethod("say", String.class);
        methods.invoke(obj,"hhhhh");

        Method method= cls.getMethod("say", String.class,int.class);

        method.invoke(obj,"hahhaha",3);

    }
}
